 <?php
 
 Kurogo::includePackage('db');

 class GmapWebModule extends WebModule
 {
   protected $id='gmap';
   protected function initializeForPage() 
   {

     switch ($this->page)
     {
         case 'index':
             $this->assign('message', 'Submits your form!');
             break;
             
         case 'form-submit':
             $db = new db();
             $session = $this->getSession();
             if($this->isLoggedIn()) 
			 {
                $user = $session->getUser();
                $userID = $user->getUserID();
                $sql = "INSERT INTO post (fbID, message, locationID) VALUES ('$userID','$_POST[message]','1')";
                $db->query($sql);

                $this->assign('message', 'Success1!');
             }
             else 
			 {
                $this->assign('message', 'Login');
             }
        
             break;
      }
   }
 }